<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='global-property-'>/**
</span> * @ignore
 * scanner cdata (script/textarea/style)
 * @author yiminghe@gmail.com
 */
KISSY.add(&quot;html-parser/scanners/cdata-scanner&quot;, function () {
    return {
        scan:function (tag, lexer, opts) {
            // only terminate when encounter &lt;/tag&gt;
            // &lt;textarea&gt;&lt;div&gt;&lt;/div&gt;&lt;/textarea&gt;
            var content = lexer.parseCDATA(opts.quoteSmart, tag.nodeName),
                position = lexer.getPosition(),
                node = lexer.nextNode();
            if (node) {
                // 这段应该永远不会执行到的
                if (node.nodeType != 1 ||
                    !(node.isEndTag() &amp;&amp;
                        node.tagName == tag.tagName)) {
                    lexer.setPosition(position);
                    node = null;
                }
            }
            tag.closed = true;
            if (content) {
                tag.appendChild(content);
            }
        }
    };
});</pre>
</body>
</html>
